package com.logic.landseaserver.ws.request;

import java.util.Date;
import java.util.List;

import com.logic.landseaserver.common.LandeaConstants;
import com.logic.landseaserver.domain.CustomerCard;
import org.hibernate.validator.constraints.NotEmpty;

import com.logic.landseaserver.common.enums.ContractStatusCodeEnum;
import com.logic.landseaserver.domain.Contract;
import com.logic.landseaserver.models.authcode.bean.UsedAuthCode;
import com.logic.landseaserver.ws.dto.UrgentDTO;

import io.swagger.annotations.ApiModelProperty;

/**
 * Created by Administrator on 2017/5/22.
 */
public class CreateOffLineContractsReq {

    @ApiModelProperty(value = "合同", position = 1)
    private Integer contractId;

    @ApiModelProperty(value = "用户ID", position = 1)
    private Integer userId;


    @ApiModelProperty(value = "项目ID", position = 1)
    @NotEmpty
    private Integer projectId;

    @ApiModelProperty(value = "姓名", position = 1)
    @NotEmpty
    private String certificatesName;
    @ApiModelProperty(value = "手机号", position = 1)
    @NotEmpty
    private String cellPhone;

    @ApiModelProperty(value = "证件ID", position = 1)
    @NotEmpty
    private String certificatesId;

    @ApiModelProperty(value = "地址", position = 1)
    @NotEmpty
    private String certificatesAddress;

    @ApiModelProperty(value = "证件类型", position = 1)
    @NotEmpty
    private String certificatesType;

    @ApiModelProperty(value = "性别", position = 1)
    @NotEmpty
    private String gender;
    @ApiModelProperty(value = "房间ID", position = 1)
    @NotEmpty
    private Integer roomId;

    @ApiModelProperty(value = "签约日期", position = 1)
    @NotEmpty
    private Date signDate;
    @ApiModelProperty(value = "入住日期", position = 1)
    @NotEmpty
    private Date inDate;
    @ApiModelProperty(value = "结束日期", position = 1)
    @NotEmpty
    private Date outDate;
    @ApiModelProperty(value = "租期", position = 1)
    @NotEmpty
    private String lease;
    @ApiModelProperty(value = "支付方式", position = 1)
    @NotEmpty
    private String paymentMode;
    @ApiModelProperty(value = "押金", position = 1)
    @NotEmpty
    private Double deposit;
    @ApiModelProperty(value = "折扣金额", position = 1)
    @NotEmpty
    private Double discount;
    @ApiModelProperty(value = "房间价格", position = 1)
    @NotEmpty
    private Double salePrice;

    @ApiModelProperty(value = "来源", position = 1)
    @NotEmpty
    private String source;
    @ApiModelProperty(value = "备注", position = 1)
    @NotEmpty
    private String remark;
    @ApiModelProperty(value = "紧急联系人", position = 1)
    @NotEmpty
    private UrgentDTO urgentDTO;
    @ApiModelProperty(value = "是否大客户", position = 1)
    @NotEmpty
    private Boolean isEnterprise;
    @ApiModelProperty(value = "支付时间", position = 1)
    @NotEmpty
    private Date payTime;

    private Double price;

    private Double totalPrice;

    @ApiModelProperty(value = "定金编号", position = 1)
    private Integer depositId;
    @ApiModelProperty(value = "租期_月", position = 1)
    private Integer leaseM;
    @ApiModelProperty(value = "租期_日", position = 1)
    private Integer leaseD;
    @ApiModelProperty(value = "付租方式_付月", position = 1)
    private Integer payM;
    @ApiModelProperty(value = "付租方式_押月", position = 1)
    private Integer depositM;
    @ApiModelProperty(value = "授权码", position = 1)
    private List<UsedAuthCode> authCodes;
    @ApiModelProperty(value = "服务费", position = 1)
    private Double propertyFee;
    @ApiModelProperty(value = "水费押金", position = 1)
    private Double waterDeposit;
    @ApiModelProperty(value = "账户名", position = 1)
    private String cardAccount;
    @ApiModelProperty(value = "持卡人姓名", position = 1)
    private String cardUserName;
    @ApiModelProperty(value = "开户行", position = 1)
    private String bankName;
    @ApiModelProperty(value = "开户行支行", position = 1)
    private String bankBrname;
    @ApiModelProperty(value = "银行卡卡号", position = 1)
    private String cardNo;
    @ApiModelProperty(value = "银行卡联系人号码", position = 1)
    private String cardCellPhone;


    public Integer getLeaseM() {
        return leaseM;
    }

    public void setLeaseM(Integer leaseM) {
        this.leaseM = leaseM;
    }

    public Integer getLeaseD() {
        return leaseD;
    }

    public void setLeaseD(Integer leaseD) {
        this.leaseD = leaseD;
    }

    public Integer getPayM() {
        return payM;
    }

    public void setPayM(Integer payM) {
        this.payM = payM;
    }

    public Integer getDepositM() {
        return depositM;
    }

    public void setDepositM(Integer depositM) {
        this.depositM = depositM;
    }

    public Integer getProjectId() {
        return projectId;
    }

    public Double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(Double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public void setProjectId(Integer projectId) {
        this.projectId = projectId;
    }

    public String getCellPhone() {
        return cellPhone;
    }

    public void setCellPhone(String cellPhone) {
        this.cellPhone = cellPhone;
    }

    public String getCertificatesName() {
        return certificatesName;
    }

    public void setCertificatesName(String certificatesName) {
        this.certificatesName = certificatesName;
    }

    public String getCertificatesId() {
        return certificatesId;
    }

    public void setCertificatesId(String certificatesId) {
        this.certificatesId = certificatesId;
    }

    public Integer getContractId() {
        return contractId;
    }

    public void setContractId(Integer contractId) {
        this.contractId = contractId;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getCertificatesAddress() {
        return certificatesAddress;
    }

    public void setCertificatesAddress(String certificatesAddress) {
        this.certificatesAddress = certificatesAddress;
    }

    public String getCertificatesType() {
        return certificatesType;
    }

    public void setCertificatesType(String certificatesType) {
        this.certificatesType = certificatesType;
    }

    public Integer getRoomId() {
        return roomId;
    }

    public void setRoomId(Integer roomId) {
        this.roomId = roomId;
    }

    public Date getSignDate() {
        return signDate;
    }

    public void setSignDate(Date signDate) {
        this.signDate = signDate;
    }

    public Date getInDate() {
        return inDate;
    }

    public void setInDate(Date inDate) {
        this.inDate = inDate;
    }

    public Date getOutDate() {
        return outDate;
    }

    public void setOutDate(Date outDate) {
        this.outDate = outDate;
    }

    public String getLease() {
        return lease;
    }

    public void setLease(String lease) {
        this.lease = lease;
    }

    public String getPaymentMode() {
        return paymentMode;
    }

    public void setPaymentMode(String paymentMode) {
        this.paymentMode = paymentMode;
    }


    public Double getDeposit() {
        return deposit;
    }

    public void setDeposit(Double deposit) {
        this.deposit = deposit;
    }

    public Double getDiscount() {
        return discount;
    }

    public void setDiscount(Double discount) {
        this.discount = discount;
    }

    public Double getSalePrice() {
        return salePrice;
    }

    public void setSalePrice(Double salePrice) {
        this.salePrice = salePrice;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public UrgentDTO getUrgentDTO() {
        return urgentDTO;
    }

    public void setUrgentDTO(UrgentDTO urgentDTO) {
        this.urgentDTO = urgentDTO;
    }

    public Boolean getEnterprise() {
        return isEnterprise;
    }

    public void setEnterprise(Boolean enterprise) {
        isEnterprise = enterprise;
    }

    public Date getPayTime() {
        return payTime;
    }

    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }

    public Integer getDepositId() {
        return depositId;
    }

    public void setDepositId(Integer depositId) {
        this.depositId = depositId;
    }

    public List<UsedAuthCode> getAuthCodes() {
        return authCodes;
    }

    public void setAuthCodes(List<UsedAuthCode> authCodes) {
        this.authCodes = authCodes;
    }

    public Double getPropertyFee() {
        return propertyFee;
    }

    public void setPropertyFee(Double propertyFee) {
        this.propertyFee = propertyFee;
    }

    public Double getWaterDeposit() {
        return waterDeposit;
    }

    public void setWaterDeposit(Double waterDeposit) {
        this.waterDeposit = waterDeposit;
    }

    public String getCardUserName() {
        return cardUserName;
    }

    public void setCardUserName(String cardUserName) {
        this.cardUserName = cardUserName;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getBankBrname() {
        return bankBrname;
    }

    public void setBankBrname(String bankBrname) {
        this.bankBrname = bankBrname;
    }

    public String getCardNo() {
        return cardNo;
    }

    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }

    public String getCardCellPhone() {
        return cardCellPhone;
    }

    public void setCardCellPhone(String cardCellPhone) {
        this.cardCellPhone = cardCellPhone;
    }

    public String getCardAccount() {
        return cardAccount;
    }

    public void setCardAccount(String cardAccount) {
        this.cardAccount = cardAccount;
    }

    public static Contract convertDTOtoContract(CreateOffLineContractsReq objCts) {
        Contract ctc = new Contract();
        // 房间信息
        ctc.setRoomId(objCts.getRoomId());
        ctc.setInDate(objCts.getInDate());
        ctc.setOutDate(objCts.getOutDate());
        ctc.setLease(objCts.getLease());
        ctc.setPaymentMode(objCts.getPaymentMode());
        // 最后的月租金
        ctc.setSalePrice(objCts.getSalePrice());
        // 折扣
        ctc.setDiscount(objCts.getDiscount());
        // 总金额=月租金*租期
        ctc.setTotalMoney(objCts.getTotalPrice());
        // 房间原价
        ctc.setOriginalPrice(objCts.getPrice());
        // 押金
        ctc.setDeposit(objCts.getDeposit());

        // 状态
        ctc.setStatus(ContractStatusCodeEnum.NEW.getCode());
        // 签约日期
        ctc.setSignDate(new Date());
        // 是否大客户
        ctc.setIsEnterprise(objCts.getEnterprise());
        // 来源
        ctc.setSource(objCts.getSource());
        // 备注
        ctc.setRemark(objCts.getRemark());
        ctc.setLeaseM(objCts.getLeaseM());
        ctc.setLeaseD(objCts.getLeaseD());
        ctc.setPayM(objCts.getPayM());
        ctc.setDepositM(objCts.getDepositM());
        ctc.setPropertyFee(objCts.getPropertyFee());//服务费
        ctc.setWaterDeposit(objCts.getWaterDeposit());
        return ctc;
    }

    public static CustomerCard convertDTOtoCustomerCard(CreateOffLineContractsReq objCts) {
        CustomerCard customerCard = new CustomerCard();
        customerCard.setBankBrname(objCts.getBankBrname());
        customerCard.setBankName(objCts.getBankName());
        customerCard.setCardNo(objCts.getCardNo());
        customerCard.setCardUserName(objCts.getCardUserName());
        customerCard.setSourceType(LandeaConstants.QueryUesdCodeType.CONTRACT);
        customerCard.setUserId(objCts.getUserId());
        customerCard.setCellPhone(objCts.getCardCellPhone());
        customerCard.setCardAccount(objCts.getCardAccount());
        return customerCard;
    }

}
